#ifndef ERROR_H
#define ERROR_H
#include <cassert>
#include <string>
#include <ctime>
#include <chrono>

void log_system_init();

void log_group(const char *label);

void info(const char *fmt, ...);

void warning(const char *fmt, ...);

void error(const char *fmt, ...);

class ProgressReporter {
private:
    const std::string label;
    const int total;
    const int interval;
    float time;
    //typedef std::chrono::high_resolution_clock::time_point time_point;
    mutable bool mStarted = false;
    mutable std::chrono::high_resolution_clock::time_point start_time_stamp;
    
public:
    ProgressReporter(const std::string& label,
                     int total,
                     const float report_interval = 0.05f);
    
    void update(const int current_idx) const;
};

//#ifndef NDEBUG
//#define NDEBUG
//#endif
#ifdef NDEBUG
#define Assert(expr) ((void)0)
#else
#define Assert(expr) \
	((expr) ? (void)0 : \
		error("Assertion \"%s\" failed in %s, line %d\n", \
				#expr, __FILE__, __LINE__))
#endif // NDEBUG

#endif // ERROR_H